// StandardKeyboard.cpp: implementation of the CStandardKeyboard class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "ansiterminal.h"
#include "StandardKeyboard.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CStandardKeyboard::CStandardKeyboard()
{
	m_pEvents = NULL;
}

CStandardKeyboard::~CStandardKeyboard()
{

}

void CStandardKeyboard::RegisterEvents(IVirtualKeyboardEvents *pEvents)
{
	m_pEvents = pEvents;
}

void CStandardKeyboard::OnChar(UINT nChar, UINT nFlags)
{
	if(m_pEvents)
	{
		m_pEvents->OnKeyPress(nChar);
	}
}

void CStandardKeyboard::OnKeyDown(UINT nChar, UINT nFlags)
{
	if(m_pEvents) 
	{
		m_pEvents->OnKeyDown((WORD)nChar, HIWORD(nFlags) & 0xFF);
	}
}
